﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public class connect
    {
            SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Quanlynhansu;Integrated Security=True");
            SqlCommand sqlcom;
            SqlDataReader sqldr;
            public string loadlable(string sql)
            {
                string ketqua = "";
                con.Open();
                sqlcom = new SqlCommand(sql, con);
                sqldr = sqlcom.ExecuteReader();
                while (sqldr.Read())
                {
                    ketqua = sqldr[0].ToString();
                }
                con.Close();
                return ketqua;
            }
        }
    }
